package com.open.rbac.model.entity.sys;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLRestriction;

import com.open.center.jpa.model.entity.IdEntity;


@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
@DynamicUpdate
@SQLRestriction("is_deleted = false")
@SQLDelete(sql = "UPDATE organization SET is_deleted = 1 WHERE id = ?")
@Entity(name = "organization")
public class Organization extends IdEntity {

    @Column(name = "id")
    private String id;

    @Column(name = "code", nullable = false, length = 64)
    private String code;

    @Column(name = "name", nullable = false, length = 64)
    private String name;

    @Column(name = "parent_id", nullable = false, length = 36)
    private String parentId;

    @Column(name = "sort", nullable = false)
    private Integer sort;

    @Column(name = "enable", nullable = false)
    private Boolean enable;

    @Column(name = "remark")
    private String remark;

}
